clear;
clc;
close all;
addpath('../02_Functions');

%------------------------------------------------------------------------%
% This file creates table 1 in the paper 
%------------------------------------------------------------------------%


% choose sample period
start_date              = datenum(1998,1,5);
finish_date             = datenum(2020,12,27);

% ---------------------------------------------------------------------------------- %

% QUOTES
file_name           = '../01_data/es_quotes_5minute_EST';

% Compute returns

winsorizing          = 0;   
alpha                = 0.99;       
replace_option       = 1; 

results             = make_returns_288(file_name,start_date,finish_date,winsorizing,alpha,replace_option);
log_return_HbH      = results.log_return_HbH_AD;
log_return_HbH      = [log_return_HbH , results.log_return_DbD_AD]; % add in CTC 

% summary stats cells

counter = 0;
for n = 1 : 25
    counter                         = counter + 1;
    temp                            = log_return_HbH(:,n);
    temp                            = getrid(temp,1,2);
    rets_cell{1,counter}            = temp;
end

fprintf(1,'*******************************************\n')
fprintf(1,' QUOTES :  \n')
fprintf(1,'*******************************************\n')

latex_out                   = 0;
log_or_simple               = 1;
file_name                   = '../00_Results/tables/summary_stats_quotes_a.tex';
rets_string                 = {'18-19', '19-20', '20-21' , '21-22' , '22-23' , '23-24' , '24-01' , '01-02' , '02-03' , '03-04', '04-05' , '05-06' , '06-07' , '07-08' , '08-09'};
hour_start                  = 1; hour_end = 15;
result                      = summary_stats(rets_cell , rets_string , latex_out , log_or_simple , file_name,hour_start,hour_end);
file_name                   = '../00_Results/tables/summary_stats_quotes_b.tex';
rets_string                 = {'09-10' , '10-11' , '11-12' , '12-13' , '13-14', '14-15' , '15-16' , '16-17' , '17-18' };
hour_start                  = 16; hour_end = 24;
result                      = summary_stats(rets_cell , rets_string , latex_out , log_or_simple , file_name,hour_start,hour_end);

